﻿namespace Genesis.Infrastructure.Application.Specifications
{

    public class AndSpecification : Specification
    {

        private ISpecification primary;

        private ISpecification secondary;

        public AndSpecification(ISpecification primary, ISpecification secondary)
        {

            this.primary = primary;

            this.secondary = secondary;

        }

        public override bool IsSatisfiedBy(object candidate)
        {

            return primary.IsSatisfiedBy(candidate) && secondary.IsSatisfiedBy(candidate);

        }

    }

}